import React from 'react';

import BaseExecuter from '../common/BaseExecuter';
import Constants from '../../common/Constants';

import DataManager from '../../datas/DataManager';

export default class QuanZiExecuter extends BaseExecuter {
  execute(action) {
    switch (action.name) {
      case "CreateQZPostAction":
        this._createPost(action);
        break;
      case "QZ_RequestQuanziListAction":  
        this._requestList(action);
        break;
      case "QZ_RequestQuanziHotListAction":  
        this._requestHostList(action);
        break;
      case "RequestQuanziContentAction":
        this._requestQuanziContent(action);
        break;
      case "QuanziRequestHotListAction":
        this._requestQuanziHotList(action);
        break;
      case "QuanziRequestMoreRecommendListAction":
        this._requestQuanziMoreRecommendList(action);
        break;
      case "QZ_SearchBoardUserListAction":
        this._requestSearchBoardUser(action);
        break;
      case "QuanziRequestFindAction":
        this._requestQuanziFind(action);
        break;
      case "QZ_MineAction":
        this._requestQuaziMine(action);
        break;
      case "QZ_MyManagedListAction":
        this._requestMyManagedAction(action);
        break;
      case "QZ_MyCreatedListAction":
        this._requestMyCreatedAction(action);
        break;
      case "QZ_AdminListAction":
        this._requestAdminListAction(action);
        break;
      case "RendRequestQuanziHoemTuijianAction":
        this._requestQuanziHoemTuijian(action);
        break;
      case "QZ_ApplyAction":
        this._sendQuanziApply(action);
        break;
      case "RequestQuanziPostListAction":
        this._requestQuanziPostList(action);
        break;
      case "RequestQuanziChatGroupListAction":
        this._requestQuanziChatGroupList(action);
        break;
      case "QuanziRequestQuanziRandomListAction":
        this._requestRandomList(action);
        break;
      case "QuanziSendShoucangQuanziAction":
        this._sendShoucangQuanzi(action);
        break;
      case "QZ_FollowPostsListAction":
        this._requestQuanziFollowPosts(action);
        break;
      case "QuanziRequestQuitQunAciton":
        this._requestQuitQun(action);
        break;
      case "QuanziRequestQunDataAction":
        this._requestQunData(action);
        break;
      case "RequestQuanziCommentListAction":
        this._requestQuanziCommentList(action);
        break;
      case "RequestQuanziPostContentAction":
        this._requestQuanziPostContent(action);
        break;
      case "QuanziSendCommentAction":
        this._sendQuanziPostComment(action);
        break;
      case "QuanziRequestQuanziAllListAction":
         this._requestAllList(action);
        break;
      case "QuanziRequestSearchListAction":
        this._requestSearchList(action);
        break;
      case "QZ_RequestCreateQunliaoAction":
        this._requestCreateQunliao(action);
        break;
      case "QZ_sendUpdateQZSettingAction":
        this._sendUpdateQZSetting(action);
        break;
      case "QZ_RequestQunliaoListAction":
        this._requestQunliaoList(action);
        break;
      case "QZ_SearchContentAction":
        this._requestSearchContent(action);
        break;
      case "QuanziRequestEnterQunAciton":
       this._requestEnterQun(action);
       break;
      case "QuanziRequestQunMemberListAtion":
       this._requestQunMemberList(action);
       break;
      case "RequestQuanziPostLikeAction":
       this._requestPostLike(action);
       break;
      case "RequestQuanziPostShoucangAction":
       this._requestPostShoucang(action);
       break;
      case "QZ_ReportPostOrCommetAction":
       this._requestReportPostOrCommet(action);
       break;
      case "QuanziRequestQuanziMembersAtion":
       this._requestQuanziMembers(action);
       break;
      case "QuanziRequestQunliaoUnreadedNumAction":
       this._requestQunliaoUnreaded(action);
       break;
      case "QZ_Unchecked":
       this._sendQuanziUnchecked(action);
       break;
      case "QZ_UncheckedList":
       this._sendQuanziUncheckedList(action);
       break;
      case "QZ_CommentsUncheckedList":
       this._sendQuanziCommentsUncheckedList(action);
       break;
      case "QZ_FollowTo":
       this._sendQuanziFollowTo(action);
       break;
      case "QZ_FollowMe":
       this._sendQuanziFollowMe(action);
       break;
      case "QZ_FollowToPosts":
       this._sendQuanziFollowToPosts(action);
       break;
      case "QZ_FollowUser":
       this._sendQuanziFollowUser(action);
       break;
      case "QZ_DetailAction":
       this._requestQZDetailAction(action);
       break;
      case "QZ_Reply2me":
       this._sendQuanziReply2me(action);
       break;
      case "QZ_PostOrCommet":
       this._sendQuanziPostOrCommet(action);
       break;
      case "QZ_CommentShowAction":
       this._requestQuanziCommentShow(action);
       break;
      case "QZ_OwnedAction":
       this._sendQuanziQuanziOwned(action);
       break;
      case "QZ_MypostsAction":
       this._sendQuanziQuanziMyposts(action);
       break;
      case "QZ_MyspaceAction":
       this._sendQuanziQuanziMyspace(action);
       break;
      case "QZ_CreateQuanziAction":
       this._sendCreateQuanzi(action);
       break;
      case "QZ_UpdateTopAction":
       this._sendQuanziUpdateTop(action);
       break;
      case "QZ_IsAdminAction":
       this._sendQuanziIsAdminAction(action);
       break;
      default:
    }
  }
  _sendCreateQuanzi(action) {
    this._sendRequestCommonResponse(action, "sendCreateQuanzi");
  }
  _requestHostList(action) {
    this._sendRequestCommonResponse(action, "requestHostList");
  }
  _requestQuaziMine(action) {
    this._sendRequestCommonResponse(action, "requestQuaziMine");
  }
  _requestQunliaoUnreaded(action) {
    DataManager.callMethod(Constants.MODULE_TYPE.IM,
      "getUnreadedMsgNum",
      [(data)=>{action.finish(data)}]);
  }
  _requestMyCreatedAction(action) {
    this._sendRequestCommonResponse(action, "requestMyCreatedAction");
  }

  _requestMyManagedAction(action) {
    this._sendRequestCommonResponse(action, "requestMyManagedAction");
  }
  _requestQunMemberList(action) {
    this._sendRequestCommonResponse(action, "requestQunMemberList");
  }

  _requestSearchContent(action){
    this._sendRequestCommon(action, "sendRequestSearchContent");
  }

  _requestQuanziFollowPosts(action) {
    this._sendRequestCommonResponse(action, "requestQuanziFollowPosts");
  }
  _requestQunliaoList(action) {
    this._sendRequestCommonResponse(action, "requestQunliaoList");
  }
  _requestCreateQunliao(action) {
    this._sendRequestCommonResponse(action, "requestCreateQunliao");
  }
  _requestQuanziFind(action) {
    this._sendRequestCommonResponse(action, "requestQuaziFind");
  }
  _requestQuanziCommentShow(action) {
    this._sendRequestCommonResponse(action, "sendQuanziCommentShow");
  }
  //群数据
  _requestQunData(action) {
    this._sendRequestCommonResponse(action, "requestQunData");
  }

  // 退群
  _requestQuitQun(action) {
    this._sendRequestCommon(action, "requestQuitQun");
  }

    // 退群
  _requestEnterQun(action) {
    this._sendRequestCommon(action, "requestEnterQun");
  }

  //创建帖子
  _createPost(action) {
    this._sendRequestCommon(action, "createPost");
  }
  _sendQuanziApply(action) {
    this._sendRequestCommon(action, "sendQuanziApply");
  }
  _sendUpdateQZSetting(action){
    this._sendRequestCommon(action, "sendUpdateQZSetting"); 
  }
  _requestList(action) {
    this._sendRequestCommonResponse(action, "sendQuanziList");
  }

  // 圈子内容页
  _requestQuanziContent(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziContent");
  }
  // 圈子首页推荐
  _requestQuanziHoemTuijian(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziHoemTuijian");
  }

  _requestQuanziMembers(action) {
     this._sendRequestCommonResponse(action, "requestQuaziMembers");
  }

    // 圈子帖子列表
  _requestQuanziPostList(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziPostList");
  }

     // 圈子帖子列表
  _requestQuanziPostContent(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziPostContent");
  }
  _requestSearchBoardUser(action) {
    this._sendRequestCommonResponse(action, "requestSearchBoardUser");
  }
  _sendQuanziPostComment(action) {
    var data = action.data;
    this._sendRequestCommonResponse(action, "sendQuanziPostComment");
  }
  _sendQuanziUpdateTop(action) {
    this._sendRequestCommonResponse(action, "requestUpdateTop");
  }
   _requestPostLike(action) {
    var data = action.data;
    DataManager.callMethod(Constants.MODULE_TYPE.QUAN_ZI,
      "requestPostLike",
      [data, (data, isSucceed)=>{action.finish(data, isSucceed)}]);
  }

 _requestPostShoucang(action) {
    var data = action.data;
    DataManager.callMethod(Constants.MODULE_TYPE.QUAN_ZI,
      "requestPostShoucang",
      [data, (data, isSucceed)=>{action.finish(data, isSucceed)}]);
  }
  _requestReportPostOrCommet(action) {
    var data = action.data;
    DataManager.callMethod(Constants.MODULE_TYPE.QUAN_ZI,
      "requestReportPostOrCommet",
      [data, (data, isSucceed)=>{action.finish(data, isSucceed)}]);
  }

  // 圈子帖子评论列表
  _requestQuanziCommentList(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziCommentList");
  }
  _requestAdminListAction(action) {
    this._sendRequestCommonResponse(action, "requestAdminListAction");
  }
  //热门圈子
  _requestQuanziHotList(action) {
    this._sendRequestCommonResponse(action, "requestQuanziHotList");
  }
  //推荐中的更多
  _requestQuanziMoreRecommendList(action) {
    this._sendRequestCommonResponse(action, "requestQuanziMoreRecommendList");
  }
     // 圈子帖子列表
  _requestQuanziChatGroupList(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziChatGroupList");
  }

  //请求随机数据
  _requestRandomList(action) {
    this._sendRequestCommonResponse(action, "requestQuanziRandomList");
  }

   //请求分页数据
  _requestAllList(action) {
    this._sendRequestCommonResponse(action, "sendRequestQuanziAllList");
  }

    //请求分页数据
  _requestSearchList(action) {
    this._sendRequestCommonResponse(action, "sendRequestSearchList");
  }

  //收藏圈子
  _sendShoucangQuanzi(action) {
    this._sendRequestCommonResponse(action, "sendShoucangQuazi");
  }
  //获取未审核的帖子和评论数
  _sendQuanziUnchecked(action){
    this._sendRequestCommonResponse(action, "requestQuanziUnchecked");
  }
  //获取未审核的帖子列表
  _sendQuanziUncheckedList(action){
    this._sendRequestCommonResponse(action, "requestQuanziUncheckedList");
  }
  _sendQuanziIsAdminAction(action){
    this._sendRequestCommonResponse(action, "sendQuanziIsAdminAction");
  }
  //获取未审核评论列表
  _sendQuanziCommentsUncheckedList(action){
    this._sendRequestCommonResponse(action, "requestQuanziCommentsUncheckedList");
  }
  _requestQZDetailAction(action){
    this._sendRequestCommonResponse(action, "requestQZDetailAction");
  }
  //圈子模块-我关注的用户列表
  _sendQuanziFollowTo(action){
    this._sendRequestCommonResponse(action, "requestQuanziFollowTo");
  }
  //圈子模块-关注我的用户列表
  _sendQuanziFollowMe(action){
    this._sendRequestCommonResponse(action, "requestQuanziFollowMe");
  }
  //圈子模块-我关注的用户发的帖
  _sendQuanziFollowToPosts(action){
    this._sendRequestCommonResponse(action, "requestQuanziFollowToPosts");
  }
  //关注某人
  _sendQuanziFollowUser(action){
    this._sendRequestCommonResponse(action, "requestFollowUser");
  }
  //圈子模块-回复我的评论列表
  _sendQuanziReply2me(action){
    this._sendRequestCommonResponse(action, "requestQuanziReply2me");
  }
  //审核帖子或者评论 
  _sendQuanziPostOrCommet(action){
    this._sendRequestCommonResponse(action, "requestQuanziPostOrCommet");
  }
  _sendQuanziQuanziOwned(action){
    this._sendRequestCommonResponse(action, "requestQuanziOwned");
  }
  _sendQuanziQuanziMyposts(action){
    this._sendRequestCommonResponse(action, "requestQuanziMyposts");
  }
  _sendQuanziQuanziMyspace(action){
    this._sendRequestCommonResponse(action, "requestQuanziMyspace");
  }
  _getModuleType() {
    return Constants.MODULE_TYPE.QUAN_ZI;
  }
}
